package net.sareweb.acab.entity;

// Generated 15-abr-2010 14:47:16 by Hibernate Tools 3.2.5.Beta

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

/**
 * Avatar generated by hbm2java
 */
@Entity
@Table(name = "avatar", catalog = "acab")
public class Avatar implements java.io.Serializable {

	private Integer idAvatar;
	private User user;
	private String name;
	private byte[] image;
	private String format;
	private String type;

	public Avatar() {
	}

	public Avatar(User user, String name, byte[] image, String format,
			String type) {
		this.user = user;
		this.name = name;
		this.image = image;
		this.format = format;
		this.type = type;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "idAvatar", unique = true, nullable = false)
	public Integer getIdAvatar() {
		return this.idAvatar;
	}

	public void setIdAvatar(Integer idAvatar) {
		this.idAvatar = idAvatar;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user", nullable = false)
	@NotNull
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "name", nullable = false, length = 100)
	@NotNull
	@Length(max = 100)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "image", nullable = false)
	@NotNull
	public byte[] getImage() {
		return this.image;
	}

	public void setImage(byte[] image) {
		this.image = image;
	}

	@Column(name = "format", nullable = false, length = 20)
	@NotNull
	@Length(max = 20)
	public String getFormat() {
		return this.format;
	}

	public void setFormat(String format) {
		this.format = format;
	}

	@Column(name = "type", nullable = false, length = 10)
	@NotNull
	@Length(max = 10)
	public String getType() {
		return this.type;
	}

	public void setType(String type) {
		this.type = type;
	}

}
